<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>忘记密码</title>
	<link rel="stylesheet" href="__CSS__/base.css">
	<link rel="stylesheet" href="__CSS__/style.css">
	<script src="__CDN_JQ__"></script>
	<script src="__LAYER__/layer.js"></script>
</head>
<body>
	<!--头部-->
	<div class="regiup-header w clearfix">
        <div class="regiup-headerLeft">
            <a href="{:U('Index/index')}" class=" fl">
                <img src="{$logo_name}" alt=""/>
            </a>
            <h4 class="fl">找回密码</h4>
        </div>
	</div>
	<div class="regiup-sectionPt">
		<div class="regiup-section w">
			<!--栏目状态-->
			<ul class="regiup-dataColumn clearfix">
				<li class="fl clearfix">
					<em class="fl">1</em>
					<span class="fl">确认密码</span>
					<i></i>
				</li>
				<li class="fl clearfix active">
					<em class="fl active">2</em>
					<span class="fl">验证身份</span>
					<i></i>
				</li>
				<li class="fl clearfix">
					<em class="fl">3</em>
					<span class="fl">设置密码</span>
					<i></i>
				</li>
				<li class="fl clearfix">
					<em class="fl">4</em>
					<span class="fl">完成</span>
					<i></i>
				</li>
			</ul>
			<!--设置用户名-->
			<div class="regiup-form-main one w active">
				<div class="container">
					<div class="one clearfix">
						<div class="fl">你的用户名：</div>
						<div class="fr">
							{$res.user_name}
						</div>
					</div>
					<div class="one clearfix">
						<div class="fl">你的手机号：</div>
						<div class="fr">
							{$res.tel}
						</div>
					</div>
					<!--<div class="one clearfix">-->
						<!--<div class="fl">短信验证码：</div>-->
						<!--<div class="fr">-->
							<!--<input type="text" name="code" id="code" class="txt1">-->
							<!--<a href="javascript:;" type="button" class="btn" id="V-btn">获取验证码</a>-->
							<!--<input type="hidden" id="check_code" value="0">-->
							<!--<input type="hidden" name="get_code">-->
							<!--<span>请输入验证码</span>-->
						<!--</div>-->
					<!--</div>-->
                    <div class="one clearfix">
                        <div class="fl code_display">短信验证码<a class="xsg_relative">*</a></div>
                        <input type="hidden" name="get_code">
                        <input type="hidden" name="regester_type" value="{$is_start}">
                        <div class="fr code_display">
                            <input type="text" class="txt1" name="rel_code" id="code">
                            <input type="hidden" id="check_tel_code" value="0">

                            <a href="javascript:;" type="button" class="btn hover" id="V-btn">获取验证码</a>
                            <span>请输入验证码</span>
                        </div>
                    </div>
					<!--<div class="two">-->
						<!--校验码已发至你的手机，请查收-->
					<!--</div>-->
					<div class="three">
					    <input type="hidden" id="tel" value="{$res.mobile}">
					    <form action="{:U('Public/set_password')}" method="post" class="form">
					    <input type="hidden" name="id" id="id" value="{$res.id}">
					    </form>	
						<input type="button" value="下一步" id="user-btn">
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--底部-->
	<ul class="regi-footer">
		<li>
			<a href="javascript:;">关于我们</a>
			<a href="javascript:;">联系我们</a>
			<a href="javascript:;">加盟我们</a>
			<a href="javascript:;">商城APP</a>
			<a href="javascript:;" class="active">友情链接</a>
		</li>
		<li>
			<span>{$record_number}</span>
			<span class="active">有任何问题请联系我们在线客服 电话：{$intnet_phone}</span>
		</li>
		<!--<li>© 20016-2018 亿速网络用品 版权所有，并保留所有权利</li>-->
	</ul>
</body>
<script>

	var bFlag = false;
	$('#V-btn').on('click',function(){
        if(bFlag == true)return;
        var N = 60;
        var timer = null;
        var _this = $(this);
		if(bFlag == true)return;
		bFlag = true;
		$.ajax({
			type:"POST",
			url:"check_code_ajax",
//			data:'mobile='+$('#tel').val(),
			data:{'tel':$('#tel').val()},
            success: function (data) {
                if(data.status == 1){
                    console.log(data.status );
                    bFlag = true;
                    _this.removeClass('hover');
                    timer = setInterval(function(){
                        N--;
                        if(N <= 0){
                            N = 60;
                            clearInterval(timer);
                            _this.html('重新获取验证');
                            _this.addClass('hover');
                            bFlag = false;
                        }else{
                            _this.html(N+'秒后重试');
                        }
                    },1000);
                }else {
                    layer.tips('获取失败');
                    return false;
                }
            }
        })
	});
    //输入触发
    $("#code").change(function(){
        $.ajax({
            type:"POST",
            url:"check_tel_code",
            data:'code='+$(this).val(),
            success:function(data){
                if(data==1)
                {
                    $('#check_tel_code').val(1);
                    layer.tips('验证码输入正确','#V-btn');

                }else{
                    $('#check_tel_code').val(0);
                    layer.tips('验证码不正确,请重试', '#V-btn');
                }
            }
        })
    });

	$('#user-btn').on('click',function(){
		$.ajax({
			type:"POST",
			url:"check_tel_codestatus",
			data:'code='+$('#code').val()+'&tel='+$('#tel').val(),
			success:function(data){
				if(data['code']==1)
				{
					$('.form').submit();
				}else{
					layer.tips('验证码不正确,请重试', '#V-btn');
					return false;
				}
			}
		})
	});
</script>
</html>